const { defineConfig } = require('@vue/cli-service')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')

module.exports = defineConfig({
  configureWebpack: {
    plugins: [
      AutoImport({
        resolvers: [ElementPlusResolver()],
      }),
      Components({
        resolvers: [ElementPlusResolver()],
      }),
    ],
  },
  transpileDependencies: true,
  devServer: {
    // 端口配置
    port: 1888,
    // 反向代理配置
    proxy: {
      '/api': {
        target: 'http://localhost:8000',
        ws: true,
        pathRewrite: {
          '^/api': '/'
        }
      }
    },
    compress: false //是否压缩 
    // before(app){
    //   app.get('dev_url/a',(req,res)=>{
    //     res.json({
    //       code:200,
    //       msg:'ok',
    //       data:[1,2,3,4,5,6]
    //     })
    //   })
    // }
  }

})
